home *** CD-ROM | disk | FTP | other *** search
/ Openstep 4.2 (Developer) / Openstep Developer 4.2.iso / NextDeveloper / OpenStepConversion / IntermediateFrameworks1 / SoundKit.framework / Headers / Sound.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-15  |  4.6 KB  |  179 lines

  1. /*
  2.     Sound.h
  3.     Sound Kit, Release 2.0
  4.     Copyright (c) 1988, 1989, 1990, NeXT, Inc.  All rights reserved. 
  5. */
  6.  
  7. #import <objc/Object.h>
  8. #import <objc/hashtable.h>
  9. #import <objc/NXBundle.h>
  10. #import <streams/streams.h>
  11. #import <sound/sound.h>
  12.  
  13. @class NSPasteboard;
  14. @class NSString;
  15. @class NSBundle;
  16.  
  17. /* Define this for compatibility */
  18. #define NXSoundPboard NXSoundPboardType
  19.  
  20. extern NXAtom NXSoundPboardType;
  21. /*
  22.  * This is the sound pasteboard type.
  23.  */
  24.  
  25. @interface Sound : Object
  26. /*
  27.  * The Sound object encapsulates a SNDSoundStruct, which represents a sound.
  28.  * It supports reading and writing to a soundfile, playback of sound,
  29.  * recording of sampled sound, conversion among various sampled formats, 
  30.  * basic editing of the sound, and name and storage management for sounds.
  31.  */
  32.  {
  33.     SNDSoundStruct *soundStruct; /* the sound data structure */
  34.     int soundStructSize;     /* the length of the structure in bytes */
  35.     int priority;         /* the priority of the sound */
  36.     id delegate;         /* the target of notification messages */
  37.     int status;             /* what the object is currently doing */
  38.     char *name;             /* The name of the sound */
  39.     SNDSoundStruct *_scratchSound;
  40.     int _scratchSize;
  41. }
  42.  
  43. /*
  44.  * Status codes
  45.  */
  46. typedef enum {
  47.     NX_SoundStopped = 0,
  48.     NX_SoundRecording,
  49.     NX_SoundPlaying,
  50.     NX_SoundInitialized,
  51.     NX_SoundRecordingPaused,
  52.     NX_SoundPlayingPaused,
  53.     NX_SoundRecordingPending,
  54.     NX_SoundPlayingPending,
  55.     NX_SoundFreed = -1,
  56. } NXSoundStatus;
  57.  
  58. /*
  59.  * OBSOLETE status codes - use the NX ones above.
  60.  */
  61. typedef enum {
  62.     SK_STATUS_STOPPED = NX_SoundStopped,
  63.     SK_STATUS_RECORDING = NX_SoundRecording,
  64.     SK_STATUS_PLAYING = NX_SoundPlaying,
  65.     SK_STATUS_INITIALIZED = NX_SoundInitialized,
  66.     SK_STATUS_RECORDING_PAUSED = NX_SoundRecordingPaused,
  67.     SK_STATUS_PLAYING_PAUSED = NX_SoundPlayingPaused,
  68.     SK_STATUS_RECORDING_PENDING = NX_SoundRecordingPending,
  69.     SK_STATUS_PLAYING_PENDING = NX_SoundPlayingPending,
  70.     SK_STATUS_FREED = NX_SoundFreed,
  71. } SKStatus;
  72.  
  73. /*
  74.  * Macho segment name where sounds may be.
  75.  */
  76. #define NX_SOUND_SEGMENT_NAME "__SND"
  77.  
  78. /*
  79.  * OBSOLETE macho segment name - use the NX one above.
  80.  */
  81. #define SK_SEGMENT_NAME "__SND"
  82.  
  83.  
  84. /*
  85.  * --------------- Factory Methods
  86.  */
  87.  
  88. + findSoundFor:(NSString *)aName;
  89.  
  90. + addName:(NSString *)name sound:aSound;
  91. + addName:(NSString *)name fromSoundfile:(NSString *)filename;
  92. + addName:(NSString *)name fromSection:(NSString *)sectionName;
  93. + addName:(NSString *)aName fromBundle:(NSBundle *)aBundle;
  94.  
  95. + removeSoundForName:(const char *)name;
  96.  
  97. + getVolume:(float *)left :(float *)right;
  98. + setVolume:(float)left :(float)right;
  99. + (BOOL)isMuted;
  100. + setMute:(BOOL)aFlag;
  101.  
  102. - initFromSoundfile:(NSString *)filename;
  103. - initFromSection:(NSString *)sectionName;
  104. - initFromPasteboard: (NSPasteboard *)thePboard;
  105.  
  106. - free;
  107. - readSoundFromStream:(NXStream *)stream;
  108. - writeSoundToStream:(NXStream *)stream;
  109. - write:(NXTypedStream *) stream;
  110. - read:(NXTypedStream *) stream;
  111. - finishUnarchiving;
  112. - (const char *)name;
  113. - setName:(NSString *)theName;
  114. - delegate;
  115. - setDelegate:anObject;
  116. - (double)samplingRate;
  117. - (int)sampleCount;
  118. - (double)duration;
  119. - (int)channelCount;
  120. - (char *)info;
  121. - (int)infoSize;
  122. - play:sender;
  123. - (int)play;
  124. - record:sender;
  125. - (int)record;
  126. - (int)samplesProcessed;
  127. - (int)status;
  128. - (int)waitUntilStopped;
  129. - stop:sender;
  130. - (int)stop;
  131. - pause:sender;
  132. - (int)pause;
  133. - resume:sender;
  134. - (int)resume;
  135. - (int)readSoundfile:(NSString *)filename;
  136. - (int)writeSoundfile:(NSString *)filename;
  137. - (int)writeToPasteboard:(NSPasteboard *)thePboard;
  138. - (BOOL)isEmpty;
  139. - (BOOL)isEditable;
  140. - (BOOL)compatibleWith:aSound;
  141. - (BOOL)isPlayable;
  142. - (int)convertToFormat:(int)aFormat
  143.        samplingRate:(double)aRate
  144.        channelCount:(int)aChannelCount;
  145. - (int)convertToFormat:(int)aFormat;
  146. - (int)deleteSamples;
  147. - (int)deleteSamplesAt:(int)startSample count:(int)sampleCount;
  148. - (int)insertSamples:aSound at:(int)startSample;
  149. - (int)copySound:aSound;
  150. - (int)copySamples:aSound at:(int)startSample count:(int)sampleCount;
  151. - (int)compactSamples;
  152. - (BOOL)needsCompacting;
  153. - (unsigned char *)data;
  154. - (int)dataSize;
  155. - (int)dataFormat;
  156. - (int)setDataSize:(int)newDataSize
  157.      dataFormat:(int)newDataFormat
  158.      samplingRate:(double)newSamplingRate
  159.      channelCount:(int)newChannelCount
  160.      infoSize:(int)newInfoSize;
  161. - (SNDSoundStruct *)soundStruct;
  162. - (int)soundStructSize;
  163. - setSoundStruct:(SNDSoundStruct *)aStruct soundStructSize:(int)aSize;
  164. - (SNDSoundStruct *)soundStructBeingProcessed;
  165. - (int)processingError;
  166. - soundBeingProcessed;
  167. - tellDelegate:(SEL)theMessage;
  168.  
  169. @end
  170.  
  171. @interface SoundDelegate : Object
  172. - willRecord:sender;
  173. - didRecord:sender;
  174. - willPlay:sender;
  175. - didPlay:sender;
  176. - hadError:sender;
  177. @end
  178.  
  179.